<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>

<!DOCTYPE html>
<html>
<head>
	<title>药品报价</title>
	<%@ include file="/WEB-INF/component/commonCSS.jsp" %>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>解密价格公示</h1>
        <ol class="breadcrumb">
        	<li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">招标采购管理</a></li>
            <li class="active"><a href="#">报价管理</a></li>
            <li class="active"><a href="#">解密价格公示</a></li>
        </ol>
    </section>
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class="form-inline">
                    <div class="form-group form-group-xs">
                        <label for="txtDrugForm">通用名：</label>
                        <input id="qualityspecName" class="form-control" type="text" placeholder="通用名" />
                    </div>
                    
                    <div class="form-group form-group-xs">
                        <label for="txtDrugForm">药品编码：</label>
                        <input id="qualityspecCode" class="form-control" type="text" placeholder="药品编码" />
                    </div>
                    <div class="form-group form-group-xs">
                        <label for="txtDrugForm">所属项目：</label>
                        <select id="projId" class="form-control" style="width:100px;display:inline-block;"></select>
                    </div>
                    <div class="form-group form-group-xs">
                        <label for="txtDrugForm">生产企业：</label>
                        <input id="prodCompName" class="form-control" type="text" placeholder="生产企业" />
                    </div>
                    <button type="button" class="btn btn-success btn-sm" onclick="search();">查&nbsp询 </button>
                   
                </div>
            </div>
        </div>
            
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>

    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp" %>
    <script type="text/javascript">
		function search() {
			var qualityspecCode = $.trim($("#qualityspecCode").val());
			var qualityspecName = $.trim($("#qualityspecName").val());
			var projId = $.trim($("#projId").val());
			var prodCompName = $.trim($("#prodCompName").val());
			$("#gridlist").jqGrid('setGridParam',{  
		        postData:
		        {
		        	"qualityspecCode":qualityspecCode,
		        	"qualityspecName":qualityspecName,
		        	"projId":projId,
		        	"prodCompName":prodCompName
		        }
		    }).trigger("reloadGrid"); //重新载入  
		}
		
		$(function () {
			
			if("${projId}"){
				$("#projId").HNSelect({
	                url: "${ctx}/selectController/getProject.html", 
	               defaultselect:"${projId}",
	               func:function(){
	            	   $("#projId").attr("disabled",true);
	               }
	            });
				
			}else{
				$("#projId").HNSelect({
	                url: "${ctx}/selectController/getProject.html", 
	                defaultText: "<option value=''>请选择</option>"
	            });
				
			}
			
            $("#gridlist").jqGrid({
                url: "getDrugPriceDecryptPubList.html",
                mtype: "POST",
                datatype: "json",
                postData:{"projId":"${projId}"},
                autowidth: true,
                shrinkToFit:false,
                height: 270,
                colNames: ['企业名称','项目名称','药品编码', '通用名',  '剂型', '规格', '转换系数', '单位', '材质','状态','解密报价','解密时间'],
                colModel: [
					{ name: 'prodCompName', width: 200,align: 'center',},
					{ name: 'projName', width: 200,align: 'center',},
					{ name: 'qualityspecCode', width: 100,align: 'center', sortable:false},
                    { name: 'qualityspecName', width: 160,align: 'center', sortable:false },
                    { name: 'formName', width: 80 ,align: 'center', sortable:false },
                    { name: 'specName', width: 80 ,align: 'center', sortable:false },
                    { name: 'factor', width: 80,align: 'center', sortable:false },
                    { name: 'packunitName', width: 40 ,align: 'center', sortable:false },
					{ name: 'materialName', width: 80 ,align: 'center', sortable:false },
					{ name: 'decryptStatus', width: 80 ,align: 'center', sortable:false,
						formatter : function(val, opts, rowdata) {
							if(rowdata.decryptStatus=="0"){
								return "未申报";
							}else if(rowdata.decryptStatus=="1"){
								return "未解密";
							}else if(rowdata.decryptStatus=="2"){
								return "已解密";
							}else{
								return "";
							}
                    		
                    	}
					},
                    { name: 'decryptPrice', width: 60, align: "right", sortable:false },
                    { name: 'decryptDatetime', width: 150, align: "center", sortable:false }
                ],
                rowNum: 20,
                rowList: [10, 20, 50, 100],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                caption: '解密价格公示',
                jsonReader: {
                    repeatitems: false,
                    id: "projProddrugId"
                },
                gridComplete: function(){
                	var page = $("#gridlist").jqGrid('getGridParam','page');
            		var rows = $('#gridlist').getGridParam("rowNum");
            		var maxnum = (rows*page).toString();
            		var len = (maxnum.length)*10;
            		$('.jqgfirstrow').find('td').eq(0).css('width',len+'px');
                	$('#gridlist_rn').css('width',len+'px');
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
        });

    </script>
</body>
</html>